3.2 \(\int (f+\frac {g}{x})^2 (A+B \log (e (\frac {a+b x}{c+d x})^n)) \, dx\)

Optimal. Leaf size=263 \[ 2 f g \log (x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )+\frac {g^2 (a+b x) (b c-a d) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{a (c+d x) \left (a-\frac {c (a+b x)}{c+d x}\right )}+\frac {B f^2 (a+b x) \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b}-\frac {B f^2 n (b c-a d) \log (c+d x)}{b d}+\frac {B g^2 n (b c-a d) \log \left (a-\frac {c (a+b x)}{c+d x}\right )}{a c}-2 B f g n \text {Li}_2\left (-\frac {b x}{a}\right )-2 B f g n \log (x) \log \left (\frac {b x}{a}+1\right )+A f^2 x+2 B f g n \text {Li}_2\left (-\frac {d x}{c}\right )+2 B f g n \log (x) \log \left (\frac {d x}{c}+1\right ) \]

[Out]

A*f^2*x-2*B*f*g*n*ln(x)*ln(1+b*x/a)+B*f^2*(b*x+a)*ln(e*((b*x+a)/(d*x+c))^n)/b+(-a*d+b*c)*g^2*(b*x+a)*(A+B*ln(e
*((b*x+a)/(d*x+c))^n))/a/(d*x+c)/(a-c*(b*x+a)/(d*x+c))+2*f*g*ln(x)*(A+B*ln(e*((b*x+a)/(d*x+c))^n))-B*(-a*d+b*c
)*f^2*n*ln(d*x+c)/b/d+2*B*f*g*n*ln(x)*ln(1+d*x/c)+B*(-a*d+b*c)*g^2*n*ln(a-c*(b*x+a)/(d*x+c))/a/c-2*B*f*g*n*pol
ylog(2,-b*x/a)+2*B*f*g*n*polylog(2,-d*x/c)

________________________________________________________________________________________

Rubi [A]  time = 0.34, antiderivative size = 242, normalized size of antiderivative = 0.92, number of steps used = 16, number of rules used = 10, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.312, Rules used = {2528, 2486, 31, 2525, 12, 72, 2524, 2357, 2317, 2391} \[ -2 B f g n \text {PolyLog}\left (2,-\frac {b x}{a}\right )+2 B f g n \text {PolyLog}\left (2,-\frac {d x}{c}\right )+2 f g \log (x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )-\frac {g^2 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{x}+\frac {B f^2 (a+b x) \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b}-\frac {B f^2 n (b c-a d) \log (c+d x)}{b d}+\frac {B g^2 n \log (x) (b c-a d)}{a c}-2 B f g n \log (x) \log \left (\frac {b x}{a}+1\right )-\frac {b B g^2 n \log (a+b x)}{a}+A f^2 x+2 B f g n \log (x) \log \left (\frac {d x}{c}+1\right )+\frac {B d g^2 n \log (c+d x)}{c} \]

Antiderivative was successfully verified.

[In]

Int[(f + g/x)^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n]),x]

[Out]

A*f^2*x + (B*(b*c - a*d)*g^2*n*Log[x])/(a*c) - (b*B*g^2*n*Log[a + b*x])/a - 2*B*f*g*n*Log[x]*Log[1 + (b*x)/a]
+ (B*f^2*(a + b*x)*Log[e*((a + b*x)/(c + d*x))^n])/b - (g^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n]))/x + 2*f*g*
Log[x]*(A + B*Log[e*((a + b*x)/(c + d*x))^n]) - (B*(b*c - a*d)*f^2*n*Log[c + d*x])/(b*d) + (B*d*g^2*n*Log[c +
d*x])/c + 2*B*f*g*n*Log[x]*Log[1 + (d*x)/c] - 2*B*f*g*n*PolyLog[2, -((b*x)/a)] + 2*B*f*g*n*PolyLog[2, -((d*x)/
c)]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 72

Int[((e_.) + (f_.)*(x_))^(p_.)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Int[ExpandIntegrand[(
e + f*x)^p/((a + b*x)*(c + d*x)), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && IntegerQ[p]

Rule 2317

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)/((d_) + (e_.)*(x_)), x_Symbol] :> Simp[(Log[1 + (e*x)/d]*(a +
b*Log[c*x^n])^p)/e, x] - Dist[(b*n*p)/e, Int[(Log[1 + (e*x)/d]*(a + b*Log[c*x^n])^(p - 1))/x, x], x] /; FreeQ[
{a, b, c, d, e, n}, x] && IGtQ[p, 0]

Rule 2357

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*(RFx_), x_Symbol] :> With[{u = ExpandIntegrand[(a + b*Log[c*x^
n])^p, RFx, x]}, Int[u, x] /; SumQ[u]] /; FreeQ[{a, b, c, n}, x] && RationalFunctionQ[RFx, x] && IGtQ[p, 0]

Rule 2391

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> -Simp[PolyLog[2, -(c*e*x^n)]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 2486

Int[Log[(e_.)*((f_.)*((a_.) + (b_.)*(x_))^(p_.)*((c_.) + (d_.)*(x_))^(q_.))^(r_.)]^(s_.), x_Symbol] :> Simp[((
a + b*x)*Log[e*(f*(a + b*x)^p*(c + d*x)^q)^r]^s)/b, x] + Dist[(q*r*s*(b*c - a*d))/b, Int[Log[e*(f*(a + b*x)^p*
(c + d*x)^q)^r]^(s - 1)/(c + d*x), x], x] /; FreeQ[{a, b, c, d, e, f, p, q, r, s}, x] && NeQ[b*c - a*d, 0] &&
EqQ[p + q, 0] && IGtQ[s, 0]

Rule 2524

Int[((a_.) + Log[(c_.)*(RFx_)^(p_.)]*(b_.))^(n_.)/((d_.) + (e_.)*(x_)), x_Symbol] :> Simp[(Log[d + e*x]*(a + b
*Log[c*RFx^p])^n)/e, x] - Dist[(b*n*p)/e, Int[(Log[d + e*x]*(a + b*Log[c*RFx^p])^(n - 1)*D[RFx, x])/RFx, x], x
] /; FreeQ[{a, b, c, d, e, p}, x] && RationalFunctionQ[RFx, x] && IGtQ[n, 0]

Rule 2525

Int[((a_.) + Log[(c_.)*(RFx_)^(p_.)]*(b_.))^(n_.)*((d_.) + (e_.)*(x_))^(m_.), x_Symbol] :> Simp[((d + e*x)^(m
+ 1)*(a + b*Log[c*RFx^p])^n)/(e*(m + 1)), x] - Dist[(b*n*p)/(e*(m + 1)), Int[SimplifyIntegrand[((d + e*x)^(m +
 1)*(a + b*Log[c*RFx^p])^(n - 1)*D[RFx, x])/RFx, x], x], x] /; FreeQ[{a, b, c, d, e, m, p}, x] && RationalFunc
tionQ[RFx, x] && IGtQ[n, 0] && (EqQ[n, 1] || IntegerQ[m]) && NeQ[m, -1]

Rule 2528

Int[((a_.) + Log[(c_.)*(RFx_)^(p_.)]*(b_.))^(n_.)*(RGx_), x_Symbol] :> With[{u = ExpandIntegrand[(a + b*Log[c*
RFx^p])^n, RGx, x]}, Int[u, x] /; SumQ[u]] /; FreeQ[{a, b, c, p}, x] && RationalFunctionQ[RFx, x] && RationalF
unctionQ[RGx, x] && IGtQ[n, 0]

Rubi steps

\begin {align*} \int \left (f+\frac {g}{x}\right )^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx &=\int \left (f^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )+\frac {g^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{x^2}+\frac {2 f g \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{x}\right ) \, dx\\ &=f^2 \int \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx+(2 f g) \int \frac {A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{x} \, dx+g^2 \int \frac {A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{x^2} \, dx\\ &=A f^2 x-\frac {g^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{x}+2 f g \log (x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )+\left (B f^2\right ) \int \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right ) \, dx-(2 B f g n) \int \frac {(c+d x) \left (-\frac {d (a+b x)}{(c+d x)^2}+\frac {b}{c+d x}\right ) \log (x)}{a+b x} \, dx+\left (B g^2 n\right ) \int \frac {b c-a d}{x (a+b x) (c+d x)} \, dx\\ &=A f^2 x+\frac {B f^2 (a+b x) \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b}-\frac {g^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{x}+2 f g \log (x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )-\frac {\left (B (b c-a d) f^2 n\right ) \int \frac {1}{c+d x} \, dx}{b}-(2 B f g n) \int \left (\frac {b \log (x)}{a+b x}-\frac {d \log (x)}{c+d x}\right ) \, dx+\left (B (b c-a d) g^2 n\right ) \int \frac {1}{x (a+b x) (c+d x)} \, dx\\ &=A f^2 x+\frac {B f^2 (a+b x) \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b}-\frac {g^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{x}+2 f g \log (x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )-\frac {B (b c-a d) f^2 n \log (c+d x)}{b d}-(2 b B f g n) \int \frac {\log (x)}{a+b x} \, dx+(2 B d f g n) \int \frac {\log (x)}{c+d x} \, dx+\left (B (b c-a d) g^2 n\right ) \int \left (\frac {1}{a c x}+\frac {b^2}{a (-b c+a d) (a+b x)}+\frac {d^2}{c (b c-a d) (c+d x)}\right ) \, dx\\ &=A f^2 x+\frac {B (b c-a d) g^2 n \log (x)}{a c}-\frac {b B g^2 n \log (a+b x)}{a}-2 B f g n \log (x) \log \left (1+\frac {b x}{a}\right )+\frac {B f^2 (a+b x) \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b}-\frac {g^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{x}+2 f g \log (x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )-\frac {B (b c-a d) f^2 n \log (c+d x)}{b d}+\frac {B d g^2 n \log (c+d x)}{c}+2 B f g n \log (x) \log \left (1+\frac {d x}{c}\right )+(2 B f g n) \int \frac {\log \left (1+\frac {b x}{a}\right )}{x} \, dx-(2 B f g n) \int \frac {\log \left (1+\frac {d x}{c}\right )}{x} \, dx\\ &=A f^2 x+\frac {B (b c-a d) g^2 n \log (x)}{a c}-\frac {b B g^2 n \log (a+b x)}{a}-2 B f g n \log (x) \log \left (1+\frac {b x}{a}\right )+\frac {B f^2 (a+b x) \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b}-\frac {g^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{x}+2 f g \log (x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )-\frac {B (b c-a d) f^2 n \log (c+d x)}{b d}+\frac {B d g^2 n \log (c+d x)}{c}+2 B f g n \log (x) \log \left (1+\frac {d x}{c}\right )-2 B f g n \text {Li}_2\left (-\frac {b x}{a}\right )+2 B f g n \text {Li}_2\left (-\frac {d x}{c}\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.21, size = 217, normalized size = 0.83 \[ 2 f g \log (x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )-\frac {g^2 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{x}+\frac {B f^2 (a+b x) \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b}-\frac {B f^2 n (b c-a d) \log (c+d x)}{b d}-2 B f g n \left (\log (x) \left (\log \left (\frac {b x}{a}+1\right )-\log \left (\frac {d x}{c}+1\right )\right )+\text {Li}_2\left (-\frac {b x}{a}\right )-\text {Li}_2\left (-\frac {d x}{c}\right )\right )+\frac {B g^2 n (\log (x) (b c-a d)-b c \log (a+b x)+a d \log (c+d x))}{a c}+A f^2 x \]

Antiderivative was successfully verified.

[In]

Integrate[(f + g/x)^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n]),x]

[Out]

A*f^2*x + (B*f^2*(a + b*x)*Log[e*((a + b*x)/(c + d*x))^n])/b - (g^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n]))/x
+ 2*f*g*Log[x]*(A + B*Log[e*((a + b*x)/(c + d*x))^n]) - (B*(b*c - a*d)*f^2*n*Log[c + d*x])/(b*d) + (B*g^2*n*((
b*c - a*d)*Log[x] - b*c*Log[a + b*x] + a*d*Log[c + d*x]))/(a*c) - 2*B*f*g*n*(Log[x]*(Log[1 + (b*x)/a] - Log[1
+ (d*x)/c]) + PolyLog[2, -((b*x)/a)] - PolyLog[2, -((d*x)/c)])

________________________________________________________________________________________

fricas [F]  time = 0.42, size = 0, normalized size = 0.00 \[ {\rm integral}\left (\frac {A f^{2} x^{2} + 2 \, A f g x + A g^{2} + {\left (B f^{2} x^{2} + 2 \, B f g x + B g^{2}\right )} \log \left (e \left (\frac {b x + a}{d x + c}\right )^{n}\right )}{x^{2}}, x\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((f+g/x)^2*(A+B*log(e*((b*x+a)/(d*x+c))^n)),x, algorithm="fricas")

[Out]

integral((A*f^2*x^2 + 2*A*f*g*x + A*g^2 + (B*f^2*x^2 + 2*B*f*g*x + B*g^2)*log(e*((b*x + a)/(d*x + c))^n))/x^2,
 x)

________________________________________________________________________________________

giac [F(-1)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((f+g/x)^2*(A+B*log(e*((b*x+a)/(d*x+c))^n)),x, algorithm="giac")

[Out]

Timed out

________________________________________________________________________________________

maple [F]  time = 0.07, size = 0, normalized size = 0.00 \[ \int \left (f +\frac {g}{x}\right )^{2} \left (B \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right )+A \right )\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((f+g/x)^2*(B*ln(e*((b*x+a)/(d*x+c))^n)+A),x)

[Out]

int((f+g/x)^2*(B*ln(e*((b*x+a)/(d*x+c))^n)+A),x)

________________________________________________________________________________________

maxima [F]  time = 0.00, size = 0, normalized size = 0.00 \[ B f^{2} n {\left (\frac {a \log \left (b x + a\right )}{b} - \frac {c \log \left (d x + c\right )}{d}\right )} - B g^{2} n {\left (\frac {b \log \left (b x + a\right )}{a} - \frac {d \log \left (d x + c\right )}{c} - \frac {{\left (b c - a d\right )} \log \relax (x)}{a c}\right )} + B f^{2} x \log \left (e {\left (\frac {b x}{d x + c} + \frac {a}{d x + c}\right )}^{n}\right ) + A f^{2} x - 2 \, B f g \int -\frac {\log \left ({\left (b x + a\right )}^{n}\right ) - \log \left ({\left (d x + c\right )}^{n}\right ) + \log \relax (e)}{x}\,{d x} + 2 \, A f g \log \relax (x) - \frac {B g^{2} \log \left (e {\left (\frac {b x}{d x + c} + \frac {a}{d x + c}\right )}^{n}\right )}{x} - \frac {A g^{2}}{x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((f+g/x)^2*(A+B*log(e*((b*x+a)/(d*x+c))^n)),x, algorithm="maxima")

[Out]

B*f^2*n*(a*log(b*x + a)/b - c*log(d*x + c)/d) - B*g^2*n*(b*log(b*x + a)/a - d*log(d*x + c)/c - (b*c - a*d)*log
(x)/(a*c)) + B*f^2*x*log(e*(b*x/(d*x + c) + a/(d*x + c))^n) + A*f^2*x - 2*B*f*g*integrate(-(log((b*x + a)^n) -
 log((d*x + c)^n) + log(e))/x, x) + 2*A*f*g*log(x) - B*g^2*log(e*(b*x/(d*x + c) + a/(d*x + c))^n)/x - A*g^2/x

________________________________________________________________________________________

mupad [F]  time = 0.00, size = -1, normalized size = -0.00 \[ \int {\left (f+\frac {g}{x}\right )}^2\,\left (A+B\,\ln \left (e\,{\left (\frac {a+b\,x}{c+d\,x}\right )}^n\right )\right ) \,d x \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((f + g/x)^2*(A + B*log(e*((a + b*x)/(c + d*x))^n)),x)

[Out]

int((f + g/x)^2*(A + B*log(e*((a + b*x)/(c + d*x))^n)), x)

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\left (A + B \log {\left (e \left (\frac {a}{c + d x} + \frac {b x}{c + d x}\right )^{n} \right )}\right ) \left (f x + g\right )^{2}}{x^{2}}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((f+g/x)**2*(A+B*ln(e*((b*x+a)/(d*x+c))**n)),x)

[Out]

Integral((A + B*log(e*(a/(c + d*x) + b*x/(c + d*x))**n))*(f*x + g)**2/x**2, x)

________________________________________________________________________________________